package com.smrs.goods.dao;

import java.util.List;

import org.hibernate.Query;

import com.jof.framework.dao.hibernate.BaseDAOHibernateImpl;
import com.smrs.goods.model.GoodsSkuAttributeModel;

public class GoodsSkuAttributeDao extends BaseDAOHibernateImpl<GoodsSkuAttributeModel, Long>{
	/**
	 * 
	 * @param skuId
	 * @return
	 */
	public List<GoodsSkuAttributeModel> getSkuAttributeBySkuId(Long skuId){
		String hsql= " from GoodsSkuAttributeModel where skuId = " +skuId;
		Query query = this.createHQLQuery(hsql);
		List<GoodsSkuAttributeModel> list = query.list();
		return list;
	}
	/**
	 * 
	 * @param itemId
	 * @return
	 */
	public List<GoodsSkuAttributeModel> getSkuAttributeByItemId(Long itemId){
		String hsql= " from GoodsSkuAttributeModel where itemId = " +itemId;
		Query query = this.createHQLQuery(hsql);
		List<GoodsSkuAttributeModel> list = query.list();
		return list;
	}
	
	
	public List<GoodsSkuAttributeModel> findByItemIdAndAttrValueId(Long itemId,Long attributeValueId){
		String hsql= " from GoodsSkuAttributeModel where itemId = " +itemId +" and attributeValueId=" + attributeValueId;
		Query query = this.createHQLQuery(hsql);
		List<GoodsSkuAttributeModel> list = query.list();
		return list;
	}
}
